package com.hhkj.admin.invoice.model.dopo;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hhkj.admin.invoice.domain.Invoice;
import lombok.Data;

import java.util.Date;
import java.util.List;

@Data
public class InvoiceDo extends Invoice {

    /** 开票日期-开始时间 **/
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date invoicingDateStart;

    /** 开票日期-结束时间 **/
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date invoicingDateEnd;

    /** 状态列表，用于搜索 **/
    private List<String> statusCodeList;

    public void setInvoicingDateEnd(Date invoicingDateEnd) {
        if (ObjectUtil.isNotEmpty(invoicingDateEnd)) {
            this.invoicingDateEnd = DateUtil.offsetMillisecond(DateUtil.offsetDay(invoicingDateEnd, 1), -1);
        }
    }
}
